﻿using System;
using System.Collections;
using System.Text;
using PhatPhucLoc.model;
using PhatPhucLoc.util;
using System.IO;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;

namespace PhatPhucLoc.dao
{
    class SysFunctionDAO
    {
        public static ArrayList getListFunctionByRole(String roleID)
        {
            ArrayList listMenu = new ArrayList();
            SqlParameter[] param = new SqlParameter[1];
            int i = 0;

            param[i] = new SqlParameter("RoleID", SqlDbType.NVarChar);
            param[i++].Value = roleID;
            DataTable kq = DataUtil.executeStore("sp_Function_GetSysRoleFunction", param);
            foreach (DataRow row in kq.Rows)
            {
                SysRoleFuctionModel obj = new SysRoleFuctionModel();
                obj.RoleID = row["RoleID"].ToString();
                obj.FunctionID = row["ID"].ToString();
                obj.FuctionName = row["Name"].ToString();
                obj.FuctionImage = row["Image"].ToString();
                obj.FuctionLink = row["Link"].ToString();
                obj.ParentID = row["ParentID"].ToString();
                listMenu.Add(obj);
            }

            return listMenu;
        }

    }
}
